<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%><%@  page import="software_2.*, java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>result</title>
</head>
<body>
<table border="1">
<%
int n =Integer.parseInt((String)session.getAttribute("n"));
String[] th=new String[4];
th[0]="题号";th[1]="回答";th[2]="参考答案";th[3]="检查结果";
String statistics="数据统计：";String time="本次答题耗时：";String timeUnit="秒";
String quantity="本次答题数：";String status="正确： ";String rate="正确率： ";
String language=(String)request.getParameter("language");

try{
if(language.equals("complex")){
	th[0]="題號";th[1]="回答";th[2]="參考答案";th[3]="檢查結果";
	statistics="數據統計:";time="本次答題耗時：";quantity="本次答題數: ";status="正確：";rate="正確率：";}
else if(language.equals("English")){
	th[0]="NO.";th[1]="Answers";th[2]="Keys";th[3]="Check";
	statistics="Data statistics:";time="Time：";timeUnit="second";quantity="Quantity: ";status="Correct：";rate="Accuracy：";}
}catch(NullPointerException e){
}
%>
<tr>
  <th><%out.print(th[0]); %></th><th><%out.print(th[1]); %></th><th><%out.print(th[2]); %></th><th><%out.print(th[3]); %></th>
</tr> <br/><br/>
<%
String time2=request.getParameter("time");
int correct=0;
for(int i=0; i<n;i++){
	String ans=(String)request.getParameter("ans"+(i+1));
	String key=(String)request.getParameter("key"+(i+1));%>
	<tr>
  <td><%out.print("["+i+"]"); %></td> <td><%out.print(ans); %></td> <td><%out.print(key); %></td>
	<%
	if(ans.equals(key)){
		correct++;%>
		<td><% out.print(" √");%></td>
	<%}else{
		%>
		<td><% out.print(" ×");%></td>
	<%}%><br/><br/><% 
}
%>
</tr>
</table>
<br/><%out.print(statistics); %><br/><br/>
 <%out.print(time+time2+timeUnit); %><br/><br/>
<%out.print(quantity+n+", "+status+correct+", "+rate+(float)correct/n*100); %> %<br/>
</body>
</html>